<?php
// +------------------------------------------------------
// | Name: 星空框架 产品属性验证规则
// +------------------------------------------------------
// | Version: V5.0
// +------------------------------------------------------
// | Author: xkyinzhe <zhonghuaxinxing@sina.cn>
// +------------------------------------------------------
// | Time: 2021-04-25 13:05
// +------------------------------------------------------
declare(strict_types=1);

namespace app\common\validate;

use think\Validate;

/**
 * @xk 产品属性验证规则
 */
class GoodsAttr extends Validate
{
  protected $rule = [
    'goods_attr_id' => 'number|min:1',
    'goods_attr_name' => 'require|min:2|max:100',
    'order_id' => 'number|min:1',
    'status' => 'number|in:0,1'
  ];
  protected $message = [
    'goods_attr_id.number' => '请选择需要编辑的产品属性',
    'goods_attr_name.require' => '请填写产品属性名称',
    'order_id.number' => '排序ID不符合规则',
    'status.number' => '分类状态规则错误',
  ];

  protected $scene = [
    'create' => ['goods_attr_name', 'order_id', 'status'],
    'edit' => ['goods_attr_id', 'goods_attr_name', 'order_id', 'status'],
  ];
}
